<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">


    <title>后台管理——用户管理</title>

    <!-- Bootstrap core CSS -->
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/backstage_index.css}" rel="stylesheet"/>
    <link th:href="@{/css/backstage_userd.css}" rel="stylesheet"/>
</head>

<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <a href="#">汽车购票后台管理</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse manage navbar-right">
            <ul class="nav navbar-nav">
                <li><a th:href="@{/ticket/index}">车讯管理</a></li>
                <li class="actives"><a th:href="@{/customer/index}">用户管理</a></li>
            </ul>
            <div class="user">
                <a href="#">admin</a>
                <a href="#" th:href="@{/admin/login}">注销</a>
            </div>
        </div>
    </div>
</nav>

<div class="container-fluid" id="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <ul class="nav">
                <li><a th:href="@{/customer/index}">订单查询</a></li>
                <li class="active"><a th:href="@{/customer/query}">用户查询</a></li>
            </ul>
        </div>
        <div class="col-md-10 col-md-offset-2 main">
            <form class="insite form-inline" th:action="@{/customer/query}" method="post">
                <label>用戶昵称：<input type="text" id="username" name="username" class="form-control"/></label>
                <button class="btn btn-primary btn-block" type="submit">查詢</button>
            </form>
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th style="width: 20px;">#</th>
                        <th>用户名</th>
                        <th>密码</th>
                        <th>昵称</th>
                        <th>手机号码</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <div th:if="${errorMsg} != null" id="myAlert" class="alert alert-danger" data-dismiss="alert"
                         th:text="${errorMsg}">
                    </div>
                    <tr  th:each="item: ${customer}">
                        <td th:text="${item.id}" >#</td>
                        <td th:text="${item.username}">admin</td>
                        <td th:text="${item.password}">123456</td>
                        <td th:text="${item.nick_name}">咦咦咦一</td>
                        <td th:text="${item.number}">13133334444</td>
                        <td>
                            <span th:if="${item.status ==1}">正常</span>
                            <span th:if="${item.status ==0}">禁用</span>
                        </td>
                        <td>
                            <a class="normal" th:href="@{/customer/normal(id=${item.id})}">正常</a>
                            <a class="disable" th:href="@{/customer/forbidden(id=${item.id})}">禁用</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var trs = document.getElementsByTagName('tr');
    for(var i=1;i<trs.length;i++){
         var td5_1 = trs[i].children[5].children[0];
        var td6_a0 = trs[i].children[6].children[0];
        var td6_a1 = trs[i].children[6].children[1];
        if(td5_1.innerHTMl == td6_a0.innerHTMl){
            td6_a0.className = "apply";
            td6_a1.className = "disable";
        }
        if(td5_1.innerHTML == td6_a1.innerHTML){
            td6_a1.className = "apply";
            td6_a0.className = "normal";
        }
    }
</script>

</body>
</html>
